import http from "../utils/request"

//文章列表 /admin/article/articlePage
const articlePage = (data = {}) => {
    return http.request({
        url: "/admin/article/articlePage",
        method: 'get',
        data: data
    })
}

//文章详情 /admin/article/{id}
const articleInfo = (id) => {
    return http.request({
        url: "/admin/article/" + id,
        method: 'get',
        data: {}
    })
}

//修改文章 /admin/article/updateArticle
const updateArticle = (data) => {
    return http.request({
        url: "/admin/article/updateArticle",
        method: 'post',
        data: data
    })
}

//删除文章
const articleDelete = (id) => {
    return http.request({
        url: "/admin/article/" + id,
        method: 'delete',
        data: {}
    })
}

//新增文章 /admin/article/addArticle
const addArticle = (data) => {
    return http.request({
        url: "/admin/article/addArticle",
        method: 'post',
        data: data
    })
}

//文章下拉框  /admin/article/articleSelect
const articleSelect = (data) => {
    return http.request({
        url: "/admin/article/articleSelect",
        method: 'get',
        data: data
    })
}

//修改是否可见状态 /admin/article/changeViewStatus/{id}/{status}
const changeViewStatus = (data) => {
  return http.request({
    url: "/admin/article/changeViewStatus/" + data.id + "/" + data.viewStatus,
    method: 'get',
    data: {}
  })
}

//修改是否开启评论状态 /admin/article/changeCommentStatus/{id}/{status}
const changeCommentStatus = (data) => {
  return http.request({
    url: "/admin/article/changeCommentStatus/" + data.id + "/" + data.commentStatus,
    method: 'get',
    data: {}
  })
}

//修改是否推荐状态 /admin/article/changeRecommendStatus/{id}/{status}
const changeRecommendStatus = (data) => {
  return http.request({
    url: "/admin/article/changeRecommendStatus/" + data.id + "/" + data.recommendStatus,
    method: 'get',
    data: {}
  })
}

export {
    articlePage,
    articleInfo,
    articleSelect,
    articleDelete,
    addArticle,
    updateArticle,
    changeViewStatus,
    changeCommentStatus,
    changeRecommendStatus
}
